<template>
	<!--评论分页-->
	<div class="jcenter pagination">
		<el-pagination layout="total,sizes,pager" :page-size="value.pageSize" :pager-count="device=='pc'?7:5" background
			@current-change="handleCurrentChange" :total="value.total" :page-sizes="pageSizes" @size-change="handleSizeChange">
		</el-pagination>
	</div>

</template>

<script>
	export default {
		name: "Pagination",
		methods: {
			//监听页码改变的事件
			handleCurrentChange(newPage) {
				this.$emit("change", newPage,this.value.pageSize)
			},
			handleSizeChange(newSize){
				this.$emit("change", this.value.pageNum,newSize)
			}
		},
		props: {
			value: Object,
			autoScrollToTop: {
				type: Boolean,
				default: false
			},
			pageSizes:{
				type:Array,
				default:()=>[8,12,20,40,70,100]
			}
		},
		computed: {
			device() {
				return this.$store.state.device
			}
		}
	}
</script>

<style>
	.pagination {
		margin-top: 20px;
		text-align: center;
	}
</style>
